package ldk.apps.adbconnections.beans

/**
 * 作为对服务的响应
 * Created by ldkxingzhe@163.com on 2018/2/5.
 */
open class Result<T> {
    var result: T? = null
    var errcode = 0
    var errmsg: String? = null

    override fun toString(): String {
        return "Result(errcode=$errcode, errmsg=$errmsg, result=$result);"
    }
}

class AnyResult: Result<Any>(){

    companion object {
        fun withResult(result: Any): AnyResult{
            val response = AnyResult()
            response.result = result
            return response
        }

        fun withErrorCode(errorCode: Int, errMsg: String? = null): AnyResult{
            val result = AnyResult()
            result.errcode = errorCode
            result.errmsg = errMsg
            return result
        }
    }
}